/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bash.carrep.dao.enties;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author bash
 */
@Entity
@Table(name = "creditlevel", catalog = "carrepdb", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CreditLevel.findAll", query = "SELECT c FROM CreditLevel c"),
    @NamedQuery(name = "CreditLevel.findByIdcreditLevel", query = "SELECT c FROM CreditLevel c WHERE c.idcreditLevel = :idcreditLevel"),
    @NamedQuery(name = "CreditLevel.findByDescription", query = "SELECT c FROM CreditLevel c WHERE c.description = :description")})
public class CreditLevel implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "idcreditLevel", nullable = false)
    private Integer idcreditLevel;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "description", nullable = false, length = 45)
    private String description;
//    @OneToMany(cascade = CascadeType.ALL, mappedBy = "creditLevel")
//    private List<Login> loginList;

    public CreditLevel() {
    }

    public CreditLevel(Integer idcreditLevel) {
        this.idcreditLevel = idcreditLevel;
    }

    public CreditLevel(Integer idcreditLevel, String description) {
        this.idcreditLevel = idcreditLevel;
        this.description = description;
    }

    public Integer getIdcreditLevel() {
        return idcreditLevel;
    }

    public void setIdcreditLevel(Integer idcreditLevel) {
        this.idcreditLevel = idcreditLevel;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

//    @XmlTransient
//    public List<Login> getLoginList() {
//        return loginList;
//    }
//
//    public void setLoginList(List<Login> loginList) {
//        this.loginList = loginList;
//    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idcreditLevel != null ? idcreditLevel.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CreditLevel)) {
            return false;
        }
        CreditLevel other = (CreditLevel) object;
        if ((this.idcreditLevel == null && other.idcreditLevel != null) || (this.idcreditLevel != null && !this.idcreditLevel.equals(other.idcreditLevel))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.bash.carrep.dao.enties.CreditLevel[ idcreditLevel=" + idcreditLevel + " ]";
    }
    
}
